package initialize

import (
	"common/global"
	"fmt"
	"github.com/go-redis/redis/v8"
)

func InitRedis() {
	cf := Config.Redis
	global.Client = redis.NewClient(&redis.Options{
		Addr:     cf.Addr,
		Password: cf.Password,
		DB:       cf.Db,
	})
	err := global.Client.Ping(global.EmptyCtx).Err()
	if err != nil {
		panic(err)
	}
	fmt.Println("redis init success")
}
